package com.bbz.spring.bean;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * 通过实现InitializingBean,往容器中注册初始化方法
 * 通过实现DisposableBean,往容器中注册销毁方法
 */
@Component
public class Cat implements InitializingBean, DisposableBean {
    public Cat() {
        System.out.println("*******************Constructor"+this.getClass().getName());
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("*****************destroy********"+this.getClass().getName());
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("****************afterPropertiesSet*************"+this.getClass().getName());
    }
}
